import {
    BrowserRouter as Router,
    Route,
    Switch,
    Redirect
} from 'react-router-dom'
import './App.css';
import Login from './pages/Login';
import Home from './pages/Home';


function auth(props){
    if(window.sessionStorage.getItem('authkey')){
      return <Route component={Home}/>
    }
    return <Redirect to="/login"/>
  }
  
function App() {
    return (
        <Router>
            <Switch>
                <Route path="/login" component={Login}/>
                <Route path="/" render={auth} />
            </Switch>
        </Router>
    )
    
    



}

export default App;
